#ifndef BGMCONTRL_H
#define BGMCONTRL_H

#include "Cards.h"

#include <QObject>
#include <QMediaPlayer>
#include <QMediaPlaylist>

class BGMContrl : public QObject
{
    Q_OBJECT
public:
    enum RoleSex{Man, Woman};
    enum CardType{
        //单张牌
        Three,
        Four,
        Five,
        Six,
        Seven,
        Eight,
        Nine,
        Ten,
        Jack,
        Queen,
        King,
        Ace,
        Tow,
        SmallJkoer,
        BigJoker,
        //两张牌
        Three_Double,
        Four_Double,
        Five_Double,
        Six_Double,
        Seven_Double,
        Eight_Double,
        Nine_Double,
        Ten_Double,
        Jack_Double,
        Queen_Double,
        King_Double,
        Ace_Double,
        Tow_Double,
        //三张牌
        Three_Triple,
        Four_Triple,
        Five_Triple,
        Six_Triple,
        Seven_Triple,
        Eight_Triple,
        Nine_Triple,
        Ten_Triple,
        Jack_Triple,
        Queen_Triple,
        King_Triple,
        Ace_Triple,
        Tow_Triple,
        //其他组合
        Plane,
        SequencePair,
        ThreeBindOne,
        ThreeBindPair,
        Sequence,
        FourBindTwo,
        FourBind2Pair,
        Bomb,
        JokerBomb,
        Pass1,
        Pass2,
        Pass3,
        Pass4,
        MoreBiger1,//大你
        MoreBiger2,
        Biggest,//压死
        //抢地主
        NoOrder,//不叫地主
        NoRob,//不抢地主
        Order,//叫地主
        Rob1,//抢地主1
        Rob2,//抢地主2
        Last1,//只剩1张牌
        Last2//只剩2张牌
    };
    enum AssistMusic{Dispatch, SelectCard,PlaneVoice, BombVoice,Alert};
    explicit BGMContrl(QObject *parent = nullptr);

    //初始化播放列表
    void initPlayList();

    //1.背景音乐（播放和停止）
    void startBGM(int volume);
    void stopBGM();
    //2.播放玩家抢地主音乐
    void playerRobLordMousic(int point,RoleSex sex, bool isFirst);
    //3.出牌音乐
    void playCardMusic(Cards cards, bool isFirst, RoleSex sex);
    void playLastMusic(CardType type, RoleSex sex);
    //4.不出牌音乐
    void playPassMusic(RoleSex sex);
    //5.播放辅助音乐（发牌、闹钟等）
    void playAssistMusic(AssistMusic type);
    void stopAssisMusic();
    //6.播放结尾音乐
    void playEndingMusic(bool isWin);
signals:

private:
    //5个对象对应：man woman bgm 辅助音乐 结束音乐
    QVector<QMediaPlayer*> m_players;
    QVector<QMediaPlaylist*> m_lists;
};

#endif // BGMCONTRL_H
